<table class="layui-table text-center" lay-size="sm">
    <thead>
        <tr>
            <th><input type="checkbox" class="checked-all" target="purchase-id"></th>
            <th>采购单号</th>
            <th>供应商单号</th>
            <th>订单状态</th>
            <th>审批状态</th>
            <th>付款状态</th>
            <th>下单日期</th>
            <th>交货日期</th>
            <th>供应商</th>
            <th>账期</th>
            <th>应付金额</th>
            <th>总数量</th>
            <th>调入仓库</th>
            <th>备注</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        {foreach $list as $item}
        <tr>
            <td><input type="checkbox" class="purchase-id" name="purchase_id[]" value="{$item.purchase_id}"></td>
            <td class="copy-text text-left">{$item.purchase_sn}</td>
            <td class="copy-text text-left">
                {if !empty($item.producer_sn)}
                    {$item.producer_sn}
                {else}
                    <input type="text" class="layui-input input-producer-sn">
                {/if}
            </td>
            <td>{$item.order_status}</td>
            <td>{$item.check_status}</td>
            <td>{$item.pay_status}</td>
            <td>{$item.business_date}</td>
            <td>{$item.delivery_date}</td>
            <td class="text-left">{$item.producer ? $item.producer.name : ''}</td>
            <td>{$item.credit_day}天</td>
            <td>{$item.total_money - $item.pro_money}</td>
            <td>{$item.total_qty}</td>
            <td>{$item.warehouse ? $item.warehouse.name : ''}</td>
            <td class="text-left">{$item.remark}</td>
            <td class="text-left">
                <a class="layui-btn layui-btn-xs layui-btn-normal ajax-form" height-form="80%" width-form="80%" href="{:url('info', ['purchase_id'=>$item['purchase_id']])}" title="采购详情">查看</a>
                {if \app\common\model\JobFlowModule::isCheckIng($item)}
                    <a class="layui-btn layui-btn-xs check-job-flow" item="{$item.purchase_id}" title="审批">审批</a>
                {elseif \app\common\model\JobFlowModule::isCheckFinish($item) && in_array($item->getData('order_status'), $order_status_wait)/}
                    <a class="layui-btn layui-btn-xs layui-bg-orange ajax-get" href="{:url('business', ['ids'=>$item['purchase_id']])}">下单</a>
                {/if}
                {if \app\common\model\JobFlowModule::isCheckWait($item) && in_array($item->getData('order_status'), $order_status_wait)}
                    <a class="layui-btn layui-btn-xs layui-btn-normal" href="{:url('add', ['purchase_id'=>$item['purchase_id']])}" title="编辑">编辑</a>
                {/if}
                {if in_array($item->getData('pay_status'), $cancel_pay_status) && $item->getData('order_status') <= $order_cancel}
                    <a class="layui-btn layui-btn-xs layui-bg-cyan pur-cancel" item="{$item.purchase_id}" title="取消">取消</a>
                {/if}
                {if $item->getData('order_status') < $purchase_ing}
                    <a class="layui-btn layui-btn-xs layui-btn-danger ajax-get" title="删除" confirm="1" href="{:url('delete', ['purchase_id'=>$item['purchase_id']])}">删除</a>
                {/if}
                {if $item->getData('order_status') >= $purchase_ing && in_array($item->getData('pay_status'), [$pay_status_none])}
                    <a class="layui-btn layui-btn-xs ajax-get" href="{:url('dopayment', ['ids'=>$item['purchase_id']])}">申请付款</a>
                {/if}
                {if in_array($item->getData('order_status'), $show_re_btn)}
                    {if $has_pur_return}
                        <a class="layui-btn layui-btn-xs ajax-form layui-bg-orange" width-form="80%" height-form="80%" title="采购退货" href="{:url('/pur/return/add', ['purchase_id'=>$item['purchase_id']])}">退货</a>
                    {/if}
                    {if $has_pur_exchange}
                        <a class="layui-btn layui-btn-xs ajax-form" width-form="80%" height-form="80%" title="采购换货" href="{:url('/pur/exchange/add', ['purchase_id'=>$item['purchase_id']])}">换货</a>
                    {/if}
                {/if}
                {if $item->getData('order_status') == $in_stock_all && $show_verification}
                <a href="{:url('verification', ['ids'=>$item['purchase_id']])}" title="核销" confirm="1" class="layui-btn ajax-get layui-btn-xs layui-btn-danger">核销</a>
                {/if}
            </td>
        </tr>
        {/foreach}
        {empty name="list"}
        <tr>
            <td colspan="15">没有数据</td>
        </tr>
        {/empty}
    </tbody>
</table>
<div class="page">
    {$page|raw}
</div>